home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
bbs
/
qb281cz2.zip
/
STRUCT.ZIP
/
C.ZIP
/
TEST.CPP
< prev
Wrap
C/C++ Source or Header
|
1995-04-22
|
3KB
|
118 lines
#include <conio.h>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <sys\stat.h>
#include <alloc.h>
#include <iostream.h>
#include "quick280.hpp"
/* Uncomment the next line for GOLDBASE */
//#define GOLDBASE
#ifdef GOLDBASE
Integer MaxMsgAreas = 500;
Char FileExt[] = ".DAT";
#else
Integer MaxMsgAreas = 200;
Char FileExt[] = ".BBS";
#endif
Integer MaxLanguages = 30;
Integer MaxEvents = 30;
Integer MaxProtocols = 20;
int FileHandle, FileBytes;
struct ConfigRecord *CFG;
struct ConfigRecord *CFGtxt;
struct UserRecord *User;
struct UserRecord *Usertxt;
char *YesNo[2]=
{
"No","Yes",
};
char *OnOff[2]=
{
"Off","On",
};
Integer BitValue[8]=
{
1,2,4,8,16,32,64,128,
};
char *AttributeText[16]=
{
"No","Yes","No","Yes","No","Yes","No","Yes",
"No","Yes","No","Yes","No","Yes","Male ","Female",
};
void CLS();
void ShowBoolean (char *TheText,Boolean MyBoolean);
void ShowText (char *TheText,Byte LOS,char *TheString);
void ShowAttribute(char *TheText,Byte AttributeInfo, Integer Attribute);
void CLS()
{
clrscr();
}
void ShowBoolean (char *TheText,Boolean MyBoolean)
{
printf("%s%s\n",TheText,YesNo[MyBoolean]);
}
void ShowText (char *TheText,Byte LOS,char *TheString)
{
printf("%s%.*s\n",TheText,LOS,TheString);
}
void ShowAttribute(char *TheText,Byte AttributeInfo, Integer Attribute)
{
Integer TheAttribute;
TheAttribute = AttributeInfo & BitValue[Attribute];
if (TheAttribute > 0)
TheAttribute=1;
printf("%s%s\n",TheText,AttributeText[((Attribute+1)*2-2)+TheAttribute]);
}
void main(void)
{
FILE *MyFile;
CLS();
CFG = (struct ConfigRecord*) malloc(sizeof(struct ConfigRecord));
if ((FileHandle=open("QuickCFG.dat",O_RDONLY|O_BINARY)) != -1)
{
FileBytes = read(FileHandle,CFG,sizeof(struct ConfigRecord));
close(FileHandle);
fclose(MyFile);
}
User = (struct UserRecord*) malloc(sizeof(struct UserRecord));
if ((FileHandle=open("Users.dat",O_RDONLY|O_BINARY)) != -1)
{
FileBytes = read(FileHandle,User,sizeof(struct UserRecord));
close(FileHandle);
fclose(MyFile);
}
CFGtxt = CFG;
Usertxt = User;
ShowText("Editor Command String - ",CFGtxt->EditorCmdStr.LengthOfString,CFGtxt->EditorCmdStr.TheString);
ShowText("BBS Location - ",CFGtxt->Location.LengthOfString,CFGtxt->Location.TheString);
ShowBoolean("Ask For Home Phone Number - ",CFGtxt->AskHomePhone);
ShowText("User's Name - ",Usertxt->Name.LengthOfString,Usertxt->Name.TheString);
ShowAttribute("The User is a ",Usertxt->Attrib,7);
free(User);
free(CFG);
}